import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/',
      name: 'home',
      component: ()=>import('../views/TaiSH.vue')
    },
    {
      path:'/product',
      name:'product',
      children:[
        {path:'build', component: ()=>import('../views/TaiBuild.vue')},
        {path:'opt', component: ()=>import('../views/TaiOpt.vue')},
        {path:'ask', component: ()=>import('../views/TaiTech.vue')},
        {path:'team', component: ()=>import('../views/TaiTeam.vue')},
      ] 
    },
    {
      path:'/tech',
      name:'tech',
      children:[{path:'plat', component: ()=>import('../views/TaiPlat.vue')},
        {path:'sla', component: ()=>import('../views/TaiSla.vue')},
        {path:'price', component: ()=>import('../views/TaiPrice.vue')},
        {path:'solution', component: ()=>import('../views/TaiSolution.vue')},
        {path:'future', component: ()=>import('../views/TaiFuture.vue')}
      ]
    },
    {
      path:'/connect',
      name:'connect',
      component: ()=>import('../views/TaiConnect.vue')
    },
    {
      path: '/abmout-us',
      name: 'about',
      component: ()=>import('../views/TaiAbout.vue'),
      meta:{
        requiresAuth:true 
      }
    }
  ]
})

router.beforeEach((to, from, next) =>{
  if(to.meta.requiresAuth){
    console.log(to.fullPath)
  }
  next()
})

export default router
